package ay.service.impl;

import ay.dao.UserDao;
import ay.dto.UserDTO;
import ay.model.User;
import ay.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserDao userDao;

    public UserDTO find(String id){
        User user = userDao.find(id);
        return convertModel2DTO(user);
    }

    private UserDTO convertModel2DTO(User user){
        UserDTO userDTO = new UserDTO();
        userDTO.setId(user.getId());
        userDTO.setName(user.getName());
        userDTO.setAccount(user.getAccount());
        return userDTO;
    }

}
